package yueyong.salarymanagement.module.business.salary.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import yueyong.salarymanagement.module.business.salary.dao.EmployeeSalaryDao;
import yueyong.salarymanagement.module.business.salary.domain.entity.EmployeeSalaryEntity;
import yueyong.salarymanagement.module.business.salary.domain.vo.SalayIdVO;

import java.sql.Timestamp;
import java.util.List;

/**
 * Copyright: yueyong (c) 2022
 *
 * @author he.shaorong
 * @version 1.0
 * @date 2022/2/4
 */
@Service
public class EmployeeSalaryService {
    @Autowired
    private EmployeeSalaryDao employeeSalaryDao;

    public List<EmployeeSalaryEntity> getEmployeeSalaryEntityBySalaryId(long uid, long salaryId) {
        return employeeSalaryDao.getEmployeeSalaryEntityBySalaryId(uid, salaryId);
    }

    public List<EmployeeSalaryEntity> getEmployeeSalaryEntityBySalaryIdAndEmployeeId(long uid, long salaryId, long employeeId) {
        return employeeSalaryDao.getEmployeeSalaryEntityBySalaryIdAndEmployeeId(uid, salaryId, employeeId);
    }

    public List<EmployeeSalaryEntity> getInitEmployeeSalaryEntityBySalaryId(long uid, long salaryId) {
        return employeeSalaryDao.getInitEmployeeSalaryEntityBySalaryId(uid, salaryId);
    }

    public List<EmployeeSalaryEntity> getLatestEmployeeSalaryEntity(long uid) {
        return employeeSalaryDao.getLatestEmployeeSalaryEntity(uid);
    }

    public List<EmployeeSalaryEntity> getSpecifyDateEmployeeSalaryEntity(Timestamp startTime, Timestamp endTime, long uid, int sendType) {
        return employeeSalaryDao.getSpecifyDateEmployeeSalaryEntity(uid, startTime, endTime, sendType);
    }

    public List<SalayIdVO> getSpecifyDateSalaryId(Timestamp startTime, Timestamp endTime, long uid) {
        return employeeSalaryDao.getSpecifyDateSalaryId(uid, startTime, endTime);
    }

    public int addEmployeeSalaryEntity(EmployeeSalaryEntity entity) {
        int result = employeeSalaryDao.insert(entity);
        return result;
    }

    public int updateEmployeeSalaryEntity(EmployeeSalaryEntity entity) {
        int result = employeeSalaryDao.updateById(entity);
        return result;
    }
}
